﻿namespace EasyStep.TestActions.WebAii
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using ArtOfTest.WebAii.Controls.HtmlControls;
    using ArtOfTest.WebAii.Core;
    using EasyStep.TestExecution.Data;


    public static class ManagerLinkExtension
    {
        public static HtmlAnchor FindLinkByText(this Manager browser, string linkText)
        {
            HtmlAnchor result=null;
            var allLinks = browser.ActiveBrowser.Find.AllByTagName<HtmlAnchor>("a");
            foreach (var link in allLinks)
                if (linkText.Equals(link.InnerText ?? "", StringComparison.OrdinalIgnoreCase))
                {
                    result = link;
                    break;
                }
            return result;
        }
    }
}
